import _fetch from './request'
function apiGetFacelist ({ start, limit, q }) {
  return _fetch({
    url: '/articles/technic',
    needToken: true,
    params: {
      start,
      limit,
      q
    }
  })
}
// 获取市场数据
function apiGetMarketData () {
  return _fetch({
    url: '/chart-data/hot'
  })
}
// 获取面经分享数据
function apiGetShareData ({ start, limit, q }) {
  return _fetch({
    url: '/articles/share',
    needToken: true,
    params: {
      start,
      limit,
      q
    }
  })
}
// 获取面经搜索热词
function apiGetSearchHots () {
  return _fetch({
    url: '/articles/shareTopSearch'
  })
}
// 获取文章内容
function apiGetArticel (id) {
  return _fetch({
    url: `/articles/share/${id}`
  })
}
//   获取评论内容
function apiGetComment ({ id, limit, start }) {
  return _fetch({
    url: `/articles/comments/${id}`,
    params: {
      limit,
      start
    }
  })
}
// 发表评论
function apiAddComment ({ content, article, parent }) {
  return _fetch({
    url: '/articles/comments',
    method: 'POST',
    data: {
      content,
      article,
      parent
    },
    needToken: true
  })
}
// 收藏文章
function apiCollectArt (id) {
  return _fetch({
    url: '/articles/collect',
    method: 'POST',
    data: {
      id
    },
    needToken: true
  })
}
export {
  apiGetFacelist,
  apiGetMarketData,
  apiGetShareData,
  apiGetSearchHots,
  apiGetArticel,
  apiGetComment,
  apiAddComment,
  apiCollectArt
}
